const sdk = require("qiniu");
// https://developer.qiniu.com/kodo/1289/nodejs
class qiniu {
  constructor() {
    this.accessKey = "9XfBOrdQIqOtwUgsEjdGoZ6dn6aXHdSIzctY5uDj"; //此处填写公钥
    this.secretKey = "MxVSaLf4raefqz9GrxGq7IfGy_C5FsGQuYVzYbJq"; //私钥
    this.options = {
      scope: "yizhengserver",
      expires: 7200,
    };
  }
  //创建上传凭证
  uploadToken() {
    let mac = new sdk.auth.digest.Mac(this.accessKey, this.secretKey);
    let putPolicy = new sdk.rs.PutPolicy(this.options);
    let uploadToken = putPolicy.uploadToken(mac);
    return uploadToken;
  }
}
module.exports = qiniu;
